Simple Smart Memory Pool

Memory pools were previously used when writing data management structures ,in the I’ve written the memory management structure ( memory management structure) redesigned on the basis of ,Make it reach memory release “0 fragments”、Integrated management.

Memory pools currently have the following functions :
1.Adaptive allocation of a single memory pool larger than the default memory pool size(The default size of a single memory pool is 100M ,You can specify a new memory pool size by modifying macro definitions or calling modification functions ;The maximum memory allocation for a single memory pool is the same as the compiler allocation ,The maximum allocation of MFC 32-bit project is about 1G) ;

2.Each memory pool has its own memory pool description ,Whenever a new memory pool is allocated ,Memory 0-52 bytes is the description of the memory pool(This is dynamically created by the memory pool ,It changes with different compiler digits) ;

3.A single memory pool only needs to manage its own internal data list structure and data storage ,Data link list nodes are allocated directly from memory pools ,This can guarantee continuous allocation of memory pools and random release of specified memory ,Avoiding memory fragment for produce ;

4.User Memory Releasing ,Memory pool automatically merges adjacent unused memory according to internal data link list structure(Unused memory is memory managed by linked list nodes and used (no longer used) by users)And erase unwanted data linked list nodes ;Memory Achieving Recycling Conditions ,Removing the linked list nodes will be managed by the memory pool ;

5.If the memory pool is greater than or equal to two or more cases ,If memory usage does not exceed 40% of total memory ,The currently unused memory pool will be freed automatically ;

6.When Object Destruction ,All memory pools will be freed.

GitHub download address : source file!
CSDN: Blog address!